
using System;
using System.Web;
using System.Web.UI;


namespace webpman
{
	
	
	public partial class @login : System.Web.UI.Page
	{
		
		private string callpage = "";
		
		protected void Page_Load(object sender, EventArgs e)
        {

			// Manager for generic objects, settings, languages and skins
			General GeneralClass = new General();
			
			// Update current webpage with right settings
			Page MyPage = this;
			GeneralClass.SetEnvironment(ref MyPage);
			this.Page = MyPage;
			
			
			// Code...
			GeneralClass.DBOpen();
			((master1)this.Master).MasterGeneral = GeneralClass;
						
			callpage = Request.QueryString["callpage"];

			if (Request.QueryString["action"] == "logout")
			{
				Session["USER"] = null;
				Session["AUTH"] = null;
				Response.Redirect("default.aspx");
				return;
			}
			
			// Verify account
			if (txtaccount.Value != null && txtpassword.Value != null)
			{
				string accountID = GeneralClass.DBUserCheck(txtaccount.Value.Trim(), txtpassword.Value.Trim());
				if (accountID != "")
				{
					Session["USER"] = txtaccount.Value.Trim();
					Session["AUTH"] = accountID;
					Response.Redirect(callpage.Replace("_-_", "&"));
					return;
				}
			}
				
			
			
			
			
			
			
			
			
			
			
			
			head_login.InnerHtml = GeneralClass.RMan.GetString("head_login");
			lblaccount.InnerHtml = GeneralClass.RMan.GetString("useraccount");
			lblpassword.InnerHtml = GeneralClass.RMan.GetString("userpassword");
			txtaccount.Focus();
			
			// Response.Write("<!-- " + Request.Url.PathAndQuery + " -->\n");
			// Response.Write("<!-- " + txtpassword.Value + " -->\n");
			

			
			
        }
	}
}
